#ifndef PORTABLE_LOWER_H_
#define PORTABLE_LOWER_H_

#include "include/v8-version.h"
#include "src/objects/shared-function-info-inl.h"
#include "src/pbc/portable-format-helper.h"

namespace v8 {
namespace internal {
#if V8_MAJOR_VERSION == 11
using TrustedFixedArray = FixedArray;
#endif
}  // namespace internal
}  // namespace v8

namespace portable {

struct PBCLowerItems {
  PBCLowerItems(i::Isolate* isolate,
                i::Handle<i::SharedFunctionInfo> shared_func_info,
                PbcFunction pbc_func, PbcBytecode pbc_bytecode,
                PbcConstantTable pbc_constant_table,
                i::Handle<i::TrustedFixedArray> constant_pool)
      : isolate_(isolate),
        shared_func_info_(shared_func_info),
        pbc_func_(pbc_func),
        pbc_bytecode_(pbc_bytecode),
        pbc_constant_table_(pbc_constant_table),
        constant_pool_(constant_pool) {}

  i::Isolate* isolate_;
  i::Handle<i::SharedFunctionInfo> shared_func_info_;
  PbcFunction pbc_func_;
  PbcBytecode pbc_bytecode_;
  PbcConstantTable pbc_constant_table_;
  i::Handle<i::TrustedFixedArray> constant_pool_;
};

class PBCLower {
 public:
  static i::Handle<i::BytecodeArray> Lower(PBCLowerItems items);
};
}  // namespace portable

#endif  // PORTABLE_LOWER_H_